package day02;

import junit.framework.Assert;
import org.apache.shiro.authz.UnauthorizedException;
import org.junit.Test;

import java.util.Arrays;

/**
 * @author 你的名称
 * @createTime 31 15:21
 * @description
 */
public class testHasRole extends BaseTest{

    @Test(expected = UnauthorizedException.class)
    public void testHasRole(){
        login("classpath:shiro-role.ini","chu","123");
        Assert.assertTrue(subject().hasRole("role1"));
        Assert.assertTrue(subject().hasAllRoles(Arrays.asList("role2","role1")));
        boolean[] result = subject().hasRoles(Arrays.asList("role2","role3"));
        System.out.println(result[0]+"  "+result[1]);
        subject().checkRole("role3");
    }
}